<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:p="http://primefaces.org/ui" template="/layout/template.xhtml">
	<ui:define name="body">
	<script language="JavaScript" type="text/javascript">
		window.history.forward(-1);
	</script>
		<h1 class="title ui-widget-header ui-corner-all">#{message['verifica.tittle']}</h1>
		<h:form id="formVerificaCliente">
		<p:messages id="messages" showDetail="true" closable="true"/>
		<p:wizard id="wiz" widgetVar="wiz" flowListener="#{contratoForm.onFlowProcess}" nextLabel="#{message['btn.siguiente']}" backLabel="#{message['btn.atraz']}" >
		<p:tab title="#{message['verifica.tab.cliente']}">
		<p:fieldset>
        <h:panelGrid id="panelC" columns="2" cellpadding="4">
        <h:outputText value="#{message['verifica.tipo.doc']}" />
			<p:selectOneMenu id="tipoDoc" style="width:165px" value="#{verifica.idtipodoc}" required="true">
				<f:selectItems value="#{comboAction.tipoDocumentoitems}" />
				<p:ajax update="panelC"/>
			</p:selectOneMenu>
			
			<h:outputText value="#{message['verifica.num.doc']}" />
			<h:panelGroup id="nrodoc" >
				<p:inputMask id="numdoc1" value="#{verifica.objverificaclienteSie.numdocumento}" mask="99999999"
					rendered="#{verifica.idtipodoc==1}" required="true" />
					
				<p:inputMask id="numdoc2" value="#{verifica.objverificaclienteSie.numdocumento}" mask="99999999999"
					rendered="#{verifica.idtipodoc==2}" required="true" />
			</h:panelGroup>
			
        	<h:outputText value="#{message['verifica.nombre.cliente']} " />
			<p:inputText value="#{verifica.objverificaclienteSie.nombrecliente}" required="true" maxlength="140" />
			
			<h:outputText value="#{message['verifica.fecha.nacimiento']} " rendered="#{verifica.idtipodoc>1}"/>
			<p:calendar value="#{contratoForm.objClienteSie.fecnacimiento}" required="true" pattern="dd/MM/yyyy" 
			size="30" maxlength="10" locale="es" pagedate="01/01/1990" maxdate="#{contratoForm.dValidoFecNac}" rendered="#{verifica.idtipodoc>1}"/>
			</h:panelGrid>
			</p:fieldset>
			</p:tab>
			<p:tab title="#{message['verifica.tab.producto']}">
			<p:panel>
			<p:messages id="messageP" showDetail="true" closable="true"/>
				<h:panelGrid columns="2" cellpadding="6">
					<h:panelGroup>
					<p:fieldset legend="#{message['verifica.anadir.paquete']}">
					<h:panelGrid columns="2" cellpadding="4" >
					<h:outputText value="#{message['contrato.paquete']}" />
					<p:selectOneMenu filter="true" filterMatchMode="contains" value="#{verifica.idpaquete}">
						<f:selectItem itemLabel="Seleccione Paquete" itemValue="#{null}" />
						<f:selectItems value="#{comboAction.paqueteItems}" />
						<p:ajax update="lstProducto" listener="#{verifica.cambioPaquete}" />
					</p:selectOneMenu>
					</h:panelGrid>
					</p:fieldset>
					
					<p:fieldset legend="#{message['verifica.anadir.producto']}" style="margin-top:10px">
					<h:panelGrid columns="2" cellpadding="4" >
					<h:outputLabel value="#{message['contrato.tipo.producto']}" />
					<p:selectOneMenu id="tipoProd2" value="#{comboAction.tipoProducto}" style="width:240px">
						<f:selectItem itemLabel="Seleccionar tipo" itemValue="#{null}" />
						<f:selectItems value="#{comboAction.tipoitems}" />
						<p:ajax update="produc2" listener="#{comboAction.cambiar}" />
					</p:selectOneMenu>
					
					<h:outputText value="#{message['contrato.producto']}" />
					<p:selectOneMenu filter="true" filterMatchMode="contains" id="produc2" style="width:240px"
						value="#{verifica.idproducto}" >
						<f:selectItem itemLabel="Seleccione Producto" itemValue="#{null}"  />
						<f:selectItems value="#{comboAction.productositems}" />
					</p:selectOneMenu>
					
					<h:outputText value="#{message['contrato.producto.cantidad']}" />
					<p:spinner value="#{verifica.verificaProd.cantidad}" min="1" />
					
					 
					<p:commandButton value="#{message['verifica.agrega.producto']}"  icon="ui-icon ui-icon-plus" 
					action="#{verifica.productoAgregar}" update="lstProducto, messageP" />
					 
					</h:panelGrid>
					</p:fieldset>
					</h:panelGroup>
					<p:dataTable value="#{verifica.lstProducto}" id="lstProducto" var="c" paginator="true" rows="5">
						<f:facet name="header">
							<h:outputLabel value="#{message['verifica.producto.lista']}" />
						</f:facet>
						<p:column headerText="#{message['control.dt.producto']}" >
		                    <h:outputText value="#{c.tbProducto.descripcionproducto}" />
		                </p:column>
		                <p:column headerText="#{message['verifica.cantidad']}"  >
		                    <h:outputText value="#{c.cantidad}" />
		                </p:column>
		                <p:column headerText="#{message['contrato.eliminar']}" >
		                <p:commandButton icon="ui-icon-close" oncomplete="confirmationProductoVerifica.show()" title="eliminar">
							<f:setPropertyActionListener value="#{c.item}" target="#{verifica.item}" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
					</h:panelGrid>
					</p:panel>
			</p:tab>
			<p:tab title="#{message['verifica.tab.telefono']}">
			<p:panel>
			<h:panelGrid columns="2"  id="panelTlf" cellpadding="4" >
				<p:fieldset>
				<h:panelGrid columns="4" id="panelTelef" cellpadding="4" >
					<h:outputText value="#{message['contrato.tipo.telefono']}" />
					<p:selectOneMenu  value="#{verifica.tipoTelef}" style="width:165px"  >
						<f:selectItem itemLabel="Fijo" itemValue="1" />
						<f:selectItem itemLabel="Celular" itemValue="2" />
						<p:ajax  update="panelTelef" />
					</p:selectOneMenu>
					
					<h:outputText value="#{message['contrato.operadorTelefonico']}" />
					<p:selectOneMenu id="operadorTelefonico" value="#{verifica.operadortelefonico}" rendered="#{contratoForm.tipoTelef==1}"
						style="width:165px">
						<f:selectItem itemLabel="Seleccione Operador" itemValue="#{null}" />
						<f:selectItem itemLabel="Claro" itemValue="1" />
						<f:selectItem itemLabel="Telefónica" itemValue="2" />
					</p:selectOneMenu>
					
					<p:selectOneMenu id="operadorCelular" value="#{verifica.operadortelefonico}" rendered="#{contratoForm.tipoTelef==2}"
						style="width:165px" >
						<f:selectItem itemLabel="Seleccione Operador" itemValue="#{null}" />
						<f:selectItem itemLabel="Claro" itemValue="1" />
						<f:selectItem itemLabel="Movistar" itemValue="2" />
						<f:selectItem itemLabel="Nextel" itemValue="3" />
					</p:selectOneMenu>
					
					<h:outputText value="#{message['contrato.telefono']}" rendered="#{verifica.tipoTelef==1}" />
					<p:inputMask id="numTelef" mask="999-9999" value="#{verifica.verificaTel.telefono}"
					rendered="#{verifica.tipoTelef==1}"/>
					
					<h:outputText value="#{message['contrato.celular']}"  rendered="#{verifica.tipoTelef==2}"/>
					<p:inputMask mask="999-999999" value="#{verifica.verificaTel.telefono}" id="numCelular"
					rendered="#{verifica.tipoTelef==2}"/>
					
					<h:outputText value="#{message['contrato.telefono.descripcion']}" />
					<p:inputText value="#{verifica.verificaTel.desctelefono}" maxlength="45" />
					
					<p:commandButton value="#{message['verifica.agrega.telefono']}"  icon="ui-icon ui-icon-plus" 
					action="#{verifica.telefonoAgregar}" update="telefonoList, messages"/>
					
				</h:panelGrid>
				</p:fieldset>
				<p:dataTable value="#{verifica.lstTelefono}" id="telefonoList" var="t" style="width:400px" paginator="true" rows="5"
				rowStyleClass="#{t.operadortelefonico eq 'Claro' ? 'colorRojo': (t.operadortelefonico eq 'Movistar' ? 'color2': 'color3') }" >
							
							<f:facet name="header">
								<h:outputLabel value="#{message['verifica.telef.referencia']}" />
							</f:facet>
							<p:column headerText="#{message['contrato.telefono']}" >
		                    	<h:outputText value="#{t.tipotelefono}, #{t.operadortelefonico}, #{t.telefono}" />
		                    </p:column>
		                    <p:column headerText="#{message['contrato.telefono.descripcion']}"  >
		                    	<h:outputText value="#{t.desctelefono}" />
		                    </p:column>
		                    <p:column headerText="Eliminar" >
			                    <p:commandButton icon="ui-icon-close" oncomplete="confirmationTelefonoVerifica.show()" title="eliminar">
								<f:setPropertyActionListener value="#{t.telefono}" target="#{verifica.selectTelef}" />
								</p:commandButton>
							</p:column>
					</p:dataTable>
				</h:panelGrid>
				
				<p:fieldset legend="#{message['verifica.responsable']}" style="margin-top:30px">
				<h:panelGrid columns="2" cellpadding="6" >
					<h:outputText value="#{message['control.encargado']}" />
					<p:selectOneMenu value="#{verifica.idEmpleado}" style="width:220px" >
						<f:selectItem  itemValue="#{null}" itemLabel="Seleccionar Empleado" />
						<f:selectItems value="#{comboAction.empleadoxcargo}" />
					</p:selectOneMenu>
					
					<h:outputText value="#{message['verifica.observaciones']}" />
					<p:inputTextarea value="#{verifica.objverificaclienteSie.observaciones}" maxlength="40" 
					rows="3" style="width:220px" />
					<f:facet name="footer">
					<p:commandButton id="nuevoVerifica" value="#{message['verifica.registrar']}" action="#{verifica.insertar}" 
					update="message" ajax="false" title="#{message['verifica.registrar.tittle']}" icon="ui-icon ui-icon-disk"/>
					<p:tooltip for="nuevoVerifica"/>
					</f:facet>
				</h:panelGrid>
				</p:fieldset>
			</p:panel>
			</p:tab>
			</p:wizard>
		</h:form>
	</ui:define>
</ui:composition>